//
//  LSQPushTooViewController.m
//  Style
//
//  Created by dllo on 15/9/30.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "LSQPushTooViewController.h"
#import <UIImageView+WebCache.h>
#import "LSQTableViewCell.h"
#define ScreenWidth          [[UIScreen mainScreen] bounds].size.width
#define ScreenHeight         [[UIScreen mainScreen] bounds].size.height

@interface LSQPushTooViewController ()
@property (nonatomic, strong) UIScrollView *scrollView;
@end

@implementation LSQPushTooViewController

- (void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBar.translucent = NO;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    /* 创建scrollView */
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"也有意思";
    self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0,ScreenWidth, ScreenHeight - (self.navigationController.navigationBar.frame.size.height + 20))];
//    self.scrollView.pagingEnabled = YES;
    self.scrollView.showsHorizontalScrollIndicator = NO;
    self.scrollView.backgroundColor = [UIColor blackColor];
    UIImageView *imageView = [[UIImageView alloc] init];
    
    NSData *imageData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:self.imageUrl]];
    UIImage *image = [[UIImage alloc] initWithData:imageData];
    imageView.image = image;
    self.scrollView.contentSize = CGSizeMake(0, image.size.height * self.view.frame.size.width / image.size.width);
    imageView.frame = CGRectMake(0, 0, ScreenWidth, image.size.height * ScreenWidth / image.size.width);
    if (image.size.height * ScreenWidth / image.size.width < ScreenHeight) {
        
        imageView.center = CGPointMake(ScreenWidth / 2, (ScreenHeight - (self.navigationController.navigationBar.frame.size.height + self.tabBarController.tabBar.frame.size.height + 20)) / 2);
        
    }
    
    [self.scrollView addSubview:imageView];
    [self.view addSubview:self.scrollView];
    

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
